home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / comm.swg / 0060_TELIX Phone File.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-08-25  |  4.5 KB  |  144 lines

  1. {
  2. │  Post more code so we can see where you're going wrong.
  3.  
  4. I'm just posting things that are relevant, i.e. no error trapping code
  5. and such. Also I've deleted the original comments, as they are in
  6. Norwegian, and added some new in English.
  7.  
  8. Also, I use one heck of a stack. The program worked fine on my machine,
  9. I took it a friend and on his machine the default stack was too little.
  10. When I came back the exact same program that I had been using on my
  11. machine also started complaining about the stack size. Could pointers
  12. help in reducing stack?
  13.  
  14. This is the array I use to read BBS entries into from the text file
  15. }
  16.   TBbsList = Record
  17.     BBSName : Array25;   {All ArrayXX are defined as Array[1..XX] of Char}
  18.     BBSPhone : Array17;
  19.   end;
  20.  
  21. TBBSArray = Array [1..1000] of TBBSList;
  22.  
  23.  
  24. Procedure Write2Fon(bbsnumber : Integer);
  25.  
  26. {This is the definition for the Telix .fon file format}
  27. TYPE
  28.  
  29.   tddf_header = record
  30.     id          : LongInt;  (* should be hex 2e2b291a                    *)
  31.     ddf_vers    : Integer;  (* currently 1                               *)
  32.     num_entries : Integer;  (* # of entries in directory, from 1 to 1000 *)
  33.     pencrypted  : Char;     (* currently 0, will be used for encryption  *)
  34.     spare       : Array55;
  35.   end;
  36.  
  37.   tdd_entry = record
  38.     name       : Array25; (* entry name                                   *)
  39.     number     : Array17; (* phone number                                 *)
  40.     baud       : Byte;    (* baud rate, see below                         *)
  41.     parity     : Byte;    (* parity: 0 = none, 1 = even, 2 = odd          *)
  42.     data       : Byte;    (* number of data bits, 7 or 8                  *)
  43.     stop       : Byte;    (* number of stop bits, 1 or 2                  *)
  44.     script     : Array12; (* linked script file name                      *)
  45.     lastcall   : Array6;  (* last call date, stored in ASCII, w/o slashes *)
  46.     totcalls   : Word;    (* total successful calls to this entry         *)
  47.     terminal   : Byte;    (* terminal type to use, see below              *)
  48.     protocol   : Char;    (* default protocol; first letter               *)
  49.     toggles    : Byte;    (* bit 0: local echo - 0=off, 1=on              *)
  50.                           (* bit 1: add LFs    - 0=off, 1=on              *)
  51.                           (* bit 2: BS trans   - 0=destructive, 1=not     *)
  52.                           (* bit 3: BS key     - 0=sends BS, 1=sends DEL  *)
  53.     filler1    : Char;
  54.     filler2    : Char;
  55.     dprefnum   : Byte;    (* dialing prefix number to use when dialing    *)
  56.     password   : Array14; (* password for this entry                      *)
  57.   end;
  58.  
  59. VAR
  60.  FonFile : File;
  61.  BBSCount : Integer;
  62.  SPcount : Byte;
  63.  SpareArr : Array55;
  64.  DDF_Header: Tddf_Header;
  65.  DD_Entry : Array[1..500] of Tdd_Entry;
  66.  tname : array25;
  67.  tnumber : array17;
  68.  tscript : array12;
  69.  tlastcall : array6;
  70.  tpassword : array14;
  71.  bname, bnumber, bscript, blastcall, bpassword : String;
  72.  
  73.  
  74. BEGIN
  75.  
  76. Assign(FonFile, 'c:\modem\telix\test.fon'); {Yes it's hard coded right now}
  77. ReWrite(FonFile, 1);
  78.  
  79. SPcount := 1;
  80. While SPcount < 56 do
  81.   Begin
  82.     SpareArr[SPcount] := #0;
  83.     Inc(SPCount);
  84.   end;
  85.  
  86.  
  87. With DDF_Header DO Begin
  88.   ID := $2e2b291a;
  89.   DDF_Vers := 1;
  90.   Num_Entries := BBSNumber;
  91.   Pencrypted := '0';
  92.   Spare := SpareArr;
  93. end;
  94.  
  95.  
  96. bscript := 'xxxxxx';    {Just some hard coding to get things to work}
  97. blastcall := '      ';
  98. bpassword := 'xxxxxx';
  99.  
  100.  
  101. String2Arr12(bscript, tscript); {I call a simple procedure to convert}
  102.                                 {from string to array of char}
  103.  
  104. String2Arr6(blastcall, tlastcall);
  105. String2Arr14(bpassword, tpassword);
  106.  
  107. For BBSCount := 1 to BBSNumber do
  108.   Begin
  109.      With DD_entry[BBSCount] DO
  110.      Begin
  111.       name       := BBSArray[BBSCount].BBSName;
  112.       number     := BBSArray[BBSCount].BBSPhone;
  113.       baud       := 5;
  114.       parity     := 0;
  115.       data       := 8;
  116.       stop       := 1;
  117.       script     := tscript;
  118.       lastcall   := tlastcall;
  119.       totcalls   := 0;
  120.       terminal   := 1;
  121.       protocol   := 'Z';
  122.       toggles    := 0000;
  123.       filler1    := 'A';
  124.       filler2    := 'B';
  125.       dprefnum   := 1;
  126.       password   := tpassword;
  127.     end;
  128.   end;
  129.  
  130.   BlockWrite(FonFile, DDF_Header, SizeOf(DDF_Header));
  131.  
  132.   For BBSCount := 1 to BBSNumber do
  133.   Begin
  134.     BlockWrite(FonFile, DD_Entry[BBSCount], SizeOf(DD_entry[BBSCount]));
  135.                         {This could be the wrong way of doing it?}
  136.     Inc(BBSCount);
  137.   end;
  138.  
  139.  
  140.   Close(Fonfile);
  141.  
  142. end;
  143.  
  144.